<?php

declare(strict_types=1);

namespace app\admin\logic;

use app\common\model\Account as ModelAccount;

/**
 * 收支明细
 */
class Account
{
    /**
     * 获取收支明细列表
     *
     * @param array   $where
     * @param integer $page
     * @param integer $limit
     */
    public static function getLists(array $where, int $page, int $limit): array
    {
        $where = where_filter($keys, $where);
        $model = ModelAccount::withSearch($keys, $where);
        $count = $model->count();
        $list  = $model->with([
            'user' => function ($query) {
                $query->bind(['nickName', 'avatarUrl']);
            }
        ])->order('id', 'desc')->select()->hidden(['update_time', 'delete_time'])->toArray();
        return compact('count', 'list');
    }
}
